package utils

import (
	"context"
	"github.com/gin-gonic/gin"
	"wx-uniapp-go/third_party/cdslog"
	reqlogmodel "wx-uniapp-go/third_party/cdsreq/model"
)

func GetTraceId(ctx context.Context) string {
	if str, ok := ctx.Value(cdslog.LOGTRACEIDKEY).(string); ok {
		return str
	}
	return ""
}

func GetTraceIdFromGin(ctx *gin.Context) string {
	return reqlogmodel.GetTraceId(ctx.Request.Context())
}
